package com.example.xm.adapter.HomeAdapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.example.xm.R;
import com.example.xm.base.BaseAdapter;
import com.example.xm.bean.HomeBean.HomeRewardBean;

import java.util.List;

public class HomeRewardAdapter extends BaseAdapter {


    public HomeRewardAdapter(Context context, List data) {
        super(context, data);
    }

    @Override
    protected int getLayout() {
        return R.layout.adapter_reward_item;
    }

    @Override
    protected void bindData(BaseViewHolder viewHolder, Object o) {
        TextView qian = (TextView) viewHolder.getViewById(R.id.tv_qian);
        ImageView head = (ImageView) viewHolder.getViewById(R.id.iv_head_reward);
        TextView name = (TextView) viewHolder.getViewById(R.id.tv_name_reward);
        TextView data = (TextView) viewHolder.getViewById(R.id.tv_data_reward);
        TextView date = (TextView) viewHolder.getViewById(R.id.tv_date_reward_item);
        TextView canjia_num = (TextView) viewHolder.getViewById(R.id.tv_canjia_num);
        TextView sheng_num = (TextView) viewHolder.getViewById(R.id.tv_sheng_num);
        HomeRewardBean.DataBean.ListBean bean = (HomeRewardBean.DataBean.ListBean) o;
        RequestOptions requestOptions = new RequestOptions().circleCrop();
        Glide.with(context).load(bean.getHeadUrl()).apply(requestOptions).into(head);
        name.setText(bean.getNickName());
        data.setText(bean.getContent());
        date.setText(bean.getCreatetime());
        canjia_num.setText(bean.getJoinCount() + "人参加");
        sheng_num.setText(bean.getSurplusDate());
        qian.setText(bean.getRewardmoney() + "铜钱");
    }
}
